type(1)int
2025-02-04
Let’s take a look at the homework
The important question of what to do “if” something happens.
if something is True
somethingelse
something elsevalue = 3
1if value == 1:
print("the value is 2")
2elif value == 2:
print("the value is 2")
3elif value == 3:
4 print("the value is 3")
else:
print("the value is something else")value is 1
value is 2
value is 3
the value is 3
Given:
A = [3, 4, 5, 9, 12, 87, -65, 300, 450, -32]
Use for loops to:
1. Add 3 to each element of the list
2. Calculate the average of the list, but negative values are calcualted as 0s
3. Find the maximum valuen
4. Find the index (position) of the max value
! range() and enumerate() - none of the two returs a list of objects!
while something is TrueThere are useful resources regarding errors